/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "articulo")
@NamedQueries({
    @NamedQuery(name = "Articulo.findAll", query = "SELECT a FROM Articulo a"),
    @NamedQuery(name = "Articulo.findByIdArticulo", query = "SELECT a FROM Articulo a WHERE a.idArticulo = :idArticulo"),
    @NamedQuery(name = "Articulo.findBySerial", query = "SELECT a FROM Articulo a WHERE a.serial = :serial"),
    @NamedQuery(name = "Articulo.findByFacturaCompra", query = "SELECT a FROM Articulo a WHERE a.facturaCompra = :facturaCompra"),
    @NamedQuery(name = "Articulo.findByObservacion", query = "SELECT a FROM Articulo a WHERE a.observacion = :observacion")})
public class Articulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_articulo")
    private Integer idArticulo;
    @Basic(optional = false)
    @Column(name = "serial")
    private String serial;
    @Column(name = "factura_compra")
    private String facturaCompra;
    @Column(name = "observacion")
    private String observacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "articulo")
    private List<DetalleFacturaArticulo> detalleFacturaArticuloList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "articulo")
    private List<ValorAtributoArticulo> valorAtributoArticuloList;
    @JoinColumn(name = "fid_remision", referencedColumnName = "id_remision")
    @ManyToOne
    private Remision remision;
    @JoinColumn(name = "fid_modelo", referencedColumnName = "id_modelo")
    @ManyToOne(optional = false)
    private Modelo modelo;

    public Articulo() {
    }

    public Articulo(Integer idArticulo) {
        this.idArticulo = idArticulo;
    }

    public Articulo(Integer idArticulo, String serial) {
        this.idArticulo = idArticulo;
        this.serial = serial;
    }

    public Integer getIdArticulo() {
        return idArticulo;
    }

    public void setIdArticulo(Integer idArticulo) {
        this.idArticulo = idArticulo;
    }

    public String getSerial() {
        return serial;
    }

    public void setSerial(String serial) {
        this.serial = serial;
    }

    public String getFacturaCompra() {
        return facturaCompra;
    }

    public void setFacturaCompra(String facturaCompra) {
        this.facturaCompra = facturaCompra;
    }

    public String getObservacion() {
        return observacion;
    }

    public void setObservacion(String observacion) {
        this.observacion = observacion;
    }

    public List<DetalleFacturaArticulo> getDetalleFacturaArticuloList() {
        return detalleFacturaArticuloList;
    }

    public void setDetalleFacturaArticuloList(List<DetalleFacturaArticulo> detalleFacturaArticuloList) {
        this.detalleFacturaArticuloList = detalleFacturaArticuloList;
    }

    public List<ValorAtributoArticulo> getValorAtributoArticuloList() {
        return valorAtributoArticuloList;
    }

    public void setValorAtributoArticuloList(List<ValorAtributoArticulo> valorAtributoArticuloList) {
        this.valorAtributoArticuloList = valorAtributoArticuloList;
    }

    public Remision getRemision() {
        return remision;
    }

    public void setRemision(Remision remision) {
        this.remision = remision;
    }

    public Modelo getModelo() {
        return modelo;
    }

    public void setModelo(Modelo modelo) {
        this.modelo = modelo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idArticulo != null ? idArticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Articulo)) {
            return false;
        }
        Articulo other = (Articulo) object;
        if ((this.idArticulo == null && other.idArticulo != null) || (this.idArticulo != null && !this.idArticulo.equals(other.idArticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.Articulo[idArticulo=" + idArticulo + "]";
    }

}
